package com.mybatisplus.example.demo;

import org.junit.Test;
import org.yaml.snakeyaml.Yaml;

import java.io.InputStream;
import java.math.BigDecimal;
import java.util.Map;

/**
 * @ClassName YmlUtils
 * @AUTHOR MXS
 * @Date 2019/8/28 17:03
 * @Version 1.0
 **/
public class YmlUtils {

    @Test
    public void readValue(){

        Yaml yaml = new Yaml();
        //文件路径是相对类目录(src/main/java)的相对路径
        InputStream in = YmlUtils.class.getClassLoader().getResourceAsStream("application.yml");//或者app.yaml
        Map<String, Object> map = yaml.loadAs(in, Map.class);
        System.out.println(map);
    }

    @Test
    public void bigDecimalTest(){
        BigDecimal num1 = new BigDecimal(0.1);
        BigDecimal num2 = new BigDecimal("0.1");
        System.out.println(num1);
        System.out.println(num2);

    }
}
